package com.zmn.oms.zmn.normal.business.interfaces.discount;

import com.zmn.oms.common.constant.TriggerAmountChangeEnum;
import com.zmn.oms.common.exception.OmsBaseException;
import com.zmn.oms.model.bo.work.discount.UseTimesCoupBO;
import com.zmn.oms.model.bo.work.discount.WorkTimesCardInfoBO;
import com.zmn.oms.model.dto.work.modify.amount.DiscountCouponDTO;
import com.zmn.oms.model.dto.work.modify.amount.ZsDiscountDTO;
import com.zmn.oms.model.dto.work.modify.amount.ZsDiscountCouponDTO;
import com.zmn.oms.model.vo.work.modify.amount.ZsDiscountVO;

/**
 * 类描述：啄木鸟-普通单-工单优惠
 *
 * @author heciqi
 * @date 2018/12/10 21:01
 */
public interface ZsNormalOrderDiscountBService {

    /**
     * 查询人工优惠后台VO
     * @param orderId
     * @param workId
     * @param operateId
     * @return
     */
    ZsDiscountVO findDiscountVO(Long orderId, Long workId, Integer operateId) throws Exception;

    /**
     * 查询优惠金额
     */
    Integer getMaxDiscountAmount(Long orderId, Long workId, Integer operateId, Integer discountCateg) throws OmsBaseException;

    /**
     * 使用优惠券
     * @param couponDTO
     * @return
     * @see ZsNormalOrderDiscountBService#saveCoupon(com.zmn.oms.model.dto.work.modify.amount.DiscountCouponDTO)
     */
    @Deprecated
    void saveCouponOperator(ZsDiscountCouponDTO couponDTO) throws OmsBaseException;

    /**
     * 使用优惠券
     * @param couponDTO
     */
    void saveCoupon(DiscountCouponDTO couponDTO) throws OmsBaseException;

    /**
     * 保存失败的优惠券，用于记录日志
     * @param couponDTO
     * @see ZsNormalOrderDiscountBService#saveFailCoupon(com.zmn.oms.model.dto.work.modify.amount.DiscountCouponDTO)
     */
    @Deprecated
    void saveFailCouponOperator(ZsDiscountCouponDTO couponDTO);

    /**
     * 保存失败的优惠券，用于记录日志
     * @param couponDTO
     */
    void saveFailCoupon(DiscountCouponDTO couponDTO);

    /**
     * 人工优惠-运营平台操作
     * @param discountDTO
     * @return
     */
    void saveArtificialOperator(ZsDiscountDTO discountDTO, boolean couponDiscount) throws OmsBaseException;

    /**
     * 人工优惠-工程师操作
     * @param discountDTO
     * @return
     */
    void saveArtificialMaster(ZsDiscountDTO discountDTO) throws OmsBaseException;

    /**
     * 人工优惠-服务商操作
     * @param discountDTO
     * @return
     */
    void saveArtificialSp(ZsDiscountDTO discountDTO) throws OmsBaseException;

    /**
     * 人工优惠
     *
     * @param discountDTO
     * @param triggerAmountChangeEnum
     * @throws OmsBaseException
     */
    void saveDiscount(ZsDiscountDTO discountDTO, TriggerAmountChangeEnum triggerAmountChangeEnum) throws OmsBaseException;

    /**
     * 工程师-申请人工优惠次数
     * 申请次数以工程师为维度，申请一次+1
     *
     * @param orderId
     * @param masterId
     * @throws OmsBaseException
     */
    boolean addMasterApplyDiscountTimes(Long orderId, Integer masterId, Integer discountAmount);

    /**
     * 删除工程师申请优惠次数标及报价标示
     *
     * @param orderId
     * @param masterId
     * @return
     */
    boolean deleteOrderMasterApplyDiscountAndQuotation(Long orderId, Integer masterId);

    /**
     * 查询订单次卡优惠信息
     *
     * @param orderId
     * @param workId
     * @return
     */
    WorkTimesCardInfoBO getOrderTimesDiscountInfo(Long orderId, Long workId) throws OmsBaseException;

    void useTimesDiscount(UseTimesCoupBO bo) throws OmsBaseException;
}
